package com.smartjobs.reasoner;

import java.util.ArrayList;
import java.util.Iterator;

import com.hp.hpl.jena.ontology.DatatypeProperty;
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.ObjectProperty;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.util.FileManager;
import com.hp.hpl.jena.util.PrintUtil;
import com.smartjobs.bean.CourseBean;
import com.smartjobs.bean.JobApplicationsVO;
import com.smartjobs.bean.JobPostingVO;
import com.smartjobs.bean.JobSeekerVO;
import com.smartjobs.util.RuntimeSettings;

public class ReasonerQuery {

	public static void main(String[] args) {

		ArrayList<CourseBean> courses = new ReasonerQuery().getAllCourses();
		for (CourseBean bean : courses) {
			System.out.println(bean.getCourseName());
			System.out.println(bean.getCourseID());
		}

	}

	public static void printStatements(Model m, Resource s, Property p,
			Resource o) {
		for (StmtIterator i = m.listStatements(s, p, o); i.hasNext();) {
			Statement stmt = i.nextStatement();
			System.out.println(" - " + PrintUtil.print(stmt));
		}
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public ArrayList<JobPostingVO> getAllJobs() {

		Model data = FileManager.get().loadModel(
				"file:" + RuntimeSettings.location + "/MergedOntology.owl");
		ArrayList<JobPostingVO> allJobs = new ArrayList<JobPostingVO>();

		OntModel jobPosting = ModelFactory.createOntologyModel(
				OntModelSpec.OWL_MEM, data);
		OntClass smartJobs = jobPosting
				.getOntClass("http://www.smartJobs.com/vocab/jobposting_skills");
		OntClass jobs = smartJobs.getEquivalentClass();
		Iterator it1 = null, it = null;

		try {
			it1 = jobs.listInstances();
			it = smartJobs.listInstances();

			ArrayList jobIdList = new ArrayList();
			JobPostingVO jobpostVo = null;
			String skills = "";
			while (it.hasNext()) {
				Resource r = (Resource) it.next();
				ObjectProperty op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_skills_jobId");
				Resource r2 = r.getProperty(op).getObject().asResource();

				DatatypeProperty dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobId");
				String jobId = r2.getProperty(dp).getString();
				if (!jobIdList.contains(jobId)) {

					jobIdList.add(jobId);
					jobpostVo = new JobPostingVO();
					skills = "";
					jobpostVo.setJobId(r2.getProperty(dp).getInt());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobCode");
					jobpostVo.setJobCode(r2.getProperty(dp).getString());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_location");
					jobpostVo.setLocation(r2.getProperty(dp).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobDesc");
					jobpostVo.setJobDesc(r2.getProperty(dp).getString());

					op = jobPosting
							.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_companyId");
					Resource r1 = r2.getProperty(op).getObject().asResource();
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyName");
					jobpostVo.setCompanyName(r1.getProperty(dp).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyId");
					jobpostVo.setCompanyId(r1.getProperty(dp).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_emailId");
					jobpostVo.setCompanyEmailId(r1.getProperty(dp).getString());
					jobpostVo.setSource("www.smartJobs.com");

				}

				op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_skills_skillId");
				Resource r3 = r.getProperty(op).getObject().asResource();
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/skills_skillName");
				skills += (r3.getProperty(dp).getString());
				jobpostVo.setSkills(skills);
				allJobs.add(jobpostVo);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		try {
			JobPostingVO jobpostVo = null;
			ArrayList jobIdList = new ArrayList();
			String skills = null;
			while (it1.hasNext()) {
				Resource r = (Resource) it1.next();
				ObjectProperty op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_skills_jobId");
				Resource r2 = r.getProperty(op.getEquivalentProperty())
						.getObject().asResource();
				DatatypeProperty dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobId");
				String jobId = r2.getProperty(dp.getEquivalentProperty())
						.getString();
				if (!jobIdList.contains(jobId)) {

					jobIdList.add(jobId);
					jobpostVo = new JobPostingVO();
					skills = "";
					jobpostVo.setJobId(r2.getProperty(
							dp.getEquivalentProperty()).getInt());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobCode");
					jobpostVo.setJobCode(r2.getProperty(
							dp.getEquivalentProperty()).getString());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_location");
					jobpostVo.setLocation(r2.getProperty(
							dp.getEquivalentProperty()).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobDesc");
					jobpostVo.setJobDesc(r2.getProperty(
							dp.getEquivalentProperty()).getString());

					op = jobPosting
							.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_companyId");
					Resource r1 = r2.getProperty(op.getEquivalentProperty())
							.getObject().asResource();
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyName");
					jobpostVo.setCompanyName(r1.getProperty(
							dp.getEquivalentProperty()).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyId");
					jobpostVo.setCompanyId(r1.getProperty(
							dp.getEquivalentProperty()).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_emailId");
					jobpostVo.setCompanyEmailId(r1.getProperty(
							dp.getEquivalentProperty()).getString());
					jobpostVo.setSource("www.Jobs.com");
				}

				op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_skills_skillId");
				Resource r3 = r.getProperty(op.getEquivalentProperty())
						.getObject().asResource();
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/skills_skillName");
				Individual i = r.getProperty(op.getEquivalentProperty())
						.getObject().as(Individual.class);
				Resource r4 = i.getSameAs();
				if (r4 != null) {
					skills += r4.getProperty(dp).getString();
				} else {

					skills += (r3.getProperty(dp.getEquivalentProperty())
							.getString());
				}
				jobpostVo.setSkills(skills);
				allJobs.add(jobpostVo);

			}

		} catch (Exception ex) {

			ex.printStackTrace();
		}

		return allJobs;
	}

	public ArrayList<CourseBean> getAllCourses() {

		Model data = FileManager.get().loadModel(
				"file:" + RuntimeSettings.location + "/MergedOntology.owl");
		ArrayList<CourseBean> allCourses = new ArrayList<CourseBean>();

		OntModel jobPosting = ModelFactory.createOntologyModel(
				OntModelSpec.OWL_MEM, data);
		OntClass smartJobs = jobPosting
				.getOntClass("http://www.smartJobs.com/vocab/course");
		OntClass jobs = smartJobs.getEquivalentClass();
		Iterator it1 = null, it = null;

		try {
			it1 = jobs.listInstances();
			it = smartJobs.listInstances();

			CourseBean courseBean = null;
			String skills = "";
			while (it.hasNext()) {
				courseBean = new CourseBean();
				Resource r = (Resource) it.next();
				DatatypeProperty dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_courseName");
				String courseName = r.getProperty(dp).getString();
				courseBean.setCourseName(courseName);
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_description");
				courseBean.setDescription(r.getProperty(dp).getString());
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_noOfMonths");
				courseBean.setNoOfMonths(r.getProperty(dp).getString());
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_courseId");
				courseBean.setCourseID(r.getProperty(dp).getInt());
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_cost");
				courseBean.setCost(r.getProperty(dp).getString());
				ObjectProperty op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/course_trainerId");
				Resource r3 = r.getProperty(op).getObject().asResource();
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/trainer_trainerName");
				String trainer = r3.getProperty(dp).getString();
				courseBean.setTrainerName(trainer);
				courseBean.setSource("www.smartjobs.com");
				allCourses.add(courseBean);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		try {
			CourseBean courseBean = null;

			while (it1.hasNext()) {
				courseBean = new CourseBean();
				Resource r = (Resource) it1.next();
				DatatypeProperty dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_courseName");
				String courseName = r.getProperty(dp.getEquivalentProperty())
						.getString();
				courseBean.setCourseName(courseName);
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_description");
				courseBean.setDescription(r.getProperty(
						dp.getEquivalentProperty()).getString());
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_noOfMonths");
				courseBean.setNoOfMonths(r.getProperty(
						dp.getEquivalentProperty()).getString());
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_courseId");
				courseBean.setCourseID(r
						.getProperty(dp.getEquivalentProperty()).getInt());
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/course_cost");
				courseBean.setCost(r.getProperty(dp.getEquivalentProperty())
						.getString());
				ObjectProperty op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/course_trainerId");
				/*
				 * Resource
				 * r3=r.getProperty(op.getEquivalentProperty()).getObject
				 * ().asResource(); dp = jobPosting.getDatatypeProperty(
				 * "http://www.smartJobs.com/vocab/trainer_trainerName"); String
				 * trainer =
				 * r3.getProperty(dp.getEquivalentProperty()).getString();
				 * courseBean.setTrainerName(trainer);
				 */
				courseBean.setSource("www.jobs.com");
				allCourses.add(courseBean);

			}

		} catch (Exception ex) {
			System.out.println("inside ere");
			ex.printStackTrace();
		}

		return allCourses;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public ArrayList<JobSeekerVO> getAllJobSeekers() {

		Model data = FileManager.get().loadModel(
				"file:" + RuntimeSettings.location + "/MergedOntology.owl");
		ArrayList<JobSeekerVO> allJobs = new ArrayList<JobSeekerVO>();

		OntModel jobPosting = ModelFactory.createOntologyModel(
				OntModelSpec.OWL_MEM, data);
		OntClass smartJobs = jobPosting
				.getOntClass("http://www.smartJobs.com/vocab/jobseeker_skills");
		OntClass jobs = smartJobs.getEquivalentClass();
		Iterator it1 = null, it = null;

		try {
			it1 = jobs.listInstances();
			it = smartJobs.listInstances();

			ArrayList jobIdList = new ArrayList();
			JobSeekerVO jobseeker = null;
			String skills = "";
			while (it.hasNext()) {
				Resource r = (Resource) it.next();
				ObjectProperty op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/jobseeker_skills_jobSeekerId");
				Resource r2 = r.getProperty(op).getObject().asResource();

				DatatypeProperty dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_jobSeekerId");
				String jobId = r2.getProperty(dp).getString();
				if (!jobIdList.contains(jobId)) {

					if (jobseeker != null) {
						jobseeker.setSkills(skills);
						jobseeker.setSource("www.smartJobs.com");
						allJobs.add(jobseeker);
					}
					jobIdList.add(jobId);
					jobseeker = new JobSeekerVO();
					skills = "";
					System.out.println("Job Id in jobseeker:" + jobId);
					jobseeker.setId(Integer.parseInt(jobId));

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_emailId");
					jobseeker.setEmailId(r2.getProperty(dp).getString());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_mobileNumber");
					jobseeker.setPhone_no(r2.getProperty(dp).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_dob");
					jobseeker.setDate_of_birth(r2.getProperty(dp).getString());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_name");
					jobseeker.setName(r2.getProperty(dp).getString());

				}

				op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/jobseeker_skills_skillId");
				Resource r3 = r.getProperty(op).getObject().asResource();
				dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/skills_skillName");
				skills += (r3.getProperty(dp).getString()) + ",";

			}

			jobseeker.setSkills(skills);
			jobseeker.setSource("www.smartJobs.com");
			allJobs.add(jobseeker);

			System.out.println("all JObs size:" + allJobs.size());
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		try {
			JobSeekerVO jobseeker = null;
			ArrayList jobIdList = new ArrayList();

			while (it1.hasNext()) {
				Resource r = (Resource) it1.next();
				ObjectProperty op = jobPosting
						.getObjectProperty("http://www.smartJobs.com/vocab/jobseeker_skills_jobSeekerId");
				Resource r2 = r.getProperty(op.getEquivalentProperty())
						.getObject().asResource();
				System.out.println("local name:" + r2.getLocalName());
				DatatypeProperty dp = jobPosting
						.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_jobSeekerId");
				String jobId = r2.getProperty(dp.getEquivalentProperty())
						.getString();
				System.out.println("jobId:" + jobId);
				if (!jobIdList.contains(jobId)) {

					jobIdList.add(jobId);
					jobseeker = new JobSeekerVO();
					// skills = "";
					jobseeker.setId(r2.getProperty(dp.getEquivalentProperty())
							.getInt());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_emailId");
					jobseeker.setEmailId(r2.getProperty(
							dp.getEquivalentProperty()).getString());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_mobileNumber");
					jobseeker.setPhone_no(r2.getProperty(
							dp.getEquivalentProperty()).getString());
					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_dob");
					jobseeker.setDate_of_birth(r2.getProperty(
							dp.getEquivalentProperty()).getString());

					dp = jobPosting
							.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_name");
					jobseeker.setName(r2
							.getProperty(dp.getEquivalentProperty())
							.getString());

				}

				/*
				 * op=jobPosting.getObjectProperty(
				 * "http://www.smartJobs.com/vocab/jobseeker_skills_skillId");
				 * Resource
				 * r3=r.getProperty(op.getEquivalentProperty()).getObject
				 * ().asResource(); dp = jobPosting.getDatatypeProperty(
				 * "http://www.smartJobs.com/vocab/skills_skillName");
				 * skills+=(r3
				 * .getProperty(dp.getEquivalentProperty()).getString());
				 * jobseeker.setSkills(skills); allJobs.add(jobseeker);
				 */

				jobseeker.setSource("www.jobs.com");
				allJobs.add(jobseeker);

			}

		} catch (Exception ex) {

			ex.printStackTrace();
		}

		return allJobs;
	}

	@SuppressWarnings({ "rawtypes", "unused" })
	public ArrayList<JobApplicationsVO> getAllApplications() {

		Model data = FileManager.get().loadModel(
				"file:" + RuntimeSettings.location + "/MergedOntology.owl");
		ArrayList<JobApplicationsVO> allApplications = new ArrayList<JobApplicationsVO>();

		OntModel smartJobs = ModelFactory.createOntologyModel(
				OntModelSpec.OWL_MEM, data);
		Iterator classes = smartJobs.listClasses();

		OntClass application = smartJobs
				.getOntClass("http://www.smartJobs.com/vocab/application");
		OntClass application1 = application.getEquivalentClass();

		Iterator it = application.listInstances();

		while (it.hasNext()) {
			Resource r = (Resource) it.next();
			JobApplicationsVO jobAppl = new JobApplicationsVO();
			DatatypeProperty dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/application_appId");
			jobAppl.setAppId(r.getProperty(dp).getInt());
			ObjectProperty op = smartJobs
					.getObjectProperty("http://www.smartJobs.com/vocab/application_jobId");
			Resource r1 = r.getProperty(op).getObject().asResource();
			JobPostingVO jobpostVo = new JobPostingVO();
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobCode");
			jobpostVo.setJobCode(r1.getProperty(dp).getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobId");
			jobpostVo.setJobId(r1.getProperty(dp).getInt());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_location");
			jobpostVo.setLocation(r1.getProperty(dp).getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobDesc");
			jobpostVo.setJobDesc(r1.getProperty(dp).getString());
			jobAppl.setJobposting(jobpostVo);

			op = smartJobs
					.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_companyId");
			Resource r2 = r1.getProperty(op).getObject().asResource();
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyName");
			jobpostVo.setCompanyName(r2.getProperty(dp).getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyId");
			jobpostVo.setCompanyId(r2.getProperty(dp).getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_emailId");
			jobpostVo.setCompanyEmailId(r2.getProperty(dp).getString());

			op = smartJobs
					.getObjectProperty("http://www.smartJobs.com/vocab/application_jobSeekerId");
			r1 = r.getProperty(op).getObject().asResource();
			JobSeekerVO jobSeeker = new JobSeekerVO();
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_name");
			jobSeeker.setName(r1.getProperty(dp).getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_emailId");
			jobSeeker.setEmailId(r1.getProperty(dp).getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_dob");

			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_jobSeekerId");
			jobSeeker.setId(r1.getProperty(dp).getInt());

			jobAppl.setJobSeeker(jobSeeker);

			allApplications.add(jobAppl);

		}

		Iterator it1 = application1.listInstances();

		while (it1.hasNext()) {
			Resource r = (Resource) it1.next();
			JobApplicationsVO jobAppl = new JobApplicationsVO();
			DatatypeProperty dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/application_appId");
			jobAppl.setAppId(r.getProperty(dp.getEquivalentProperty()).getInt());
			ObjectProperty op = smartJobs
					.getObjectProperty("http://www.smartJobs.com/vocab/application_jobId");
			Resource r1 = r.getProperty(op.getEquivalentProperty()).getObject()
					.asResource();
			JobPostingVO jobpostVo = new JobPostingVO();
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobCode");
			jobpostVo.setJobCode(r1.getProperty(dp.getEquivalentProperty())
					.getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobId");
			jobpostVo.setJobId(r1.getProperty(dp.getEquivalentProperty())
					.getInt());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_location");
			jobpostVo.setLocation(r1.getProperty(dp.getEquivalentProperty())
					.getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobposting_jobDesc");
			jobpostVo.setJobDesc(r1.getProperty(dp.getEquivalentProperty())
					.getString());
			jobAppl.setJobposting(jobpostVo);

			op = smartJobs
					.getObjectProperty("http://www.smartJobs.com/vocab/jobposting_companyId");
			Resource r2 = r1.getProperty(op.getEquivalentProperty())
					.getObject().asResource();
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyName");
			jobpostVo.setCompanyName(r2.getProperty(dp.getEquivalentProperty())
					.getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_companyId");
			jobpostVo.setCompanyId(r2.getProperty(dp.getEquivalentProperty())
					.getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/companyprofile_emailId");
			jobpostVo.setCompanyEmailId(r2.getProperty(
					dp.getEquivalentProperty()).getString());

			op = smartJobs
					.getObjectProperty("http://www.smartJobs.com/vocab/application_jobSeekerId");
			r1 = r.getProperty(op.getEquivalentProperty()).getObject()
					.asResource();
			JobSeekerVO jobSeeker = new JobSeekerVO();
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_name");
			jobSeeker.setName(r1.getProperty(dp.getEquivalentProperty())
					.getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_emailId");
			jobSeeker.setEmailId(r1.getProperty(dp.getEquivalentProperty())
					.getString());
			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_dob");

			dp = smartJobs
					.getDatatypeProperty("http://www.smartJobs.com/vocab/jobseeker_jobSeekerId");
			jobSeeker
					.setId(r1.getProperty(dp.getEquivalentProperty()).getInt());

			jobAppl.setJobSeeker(jobSeeker);

			allApplications.add(jobAppl);

		}

		return allApplications;
	}

}
